<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>关注列表</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<{CSS}>
</head>

<body>
<div id="Container">

	<!-- header -->
	<div id="Header" class="clearfix">
		<{include file="sina/_header.html"}>
	</div>
	<!-- /header -->
	
	<!-- body -->
	<div id="Body" class="clearfix">
	
		<!-- main -->
		<div id="Wrapper">
			<div id="Main">
				<!-- 开始 -->
				<div id="fetchWhere">
					性别：
					<input type="checkbox" name="gender" value="1" /> 男
					<input type="checkbox" name="gender" value="0" /> 女
					<br />
					认证状态：
					<input type="checkbox" name="verified" value="1" /> 是
					<input type="checkbox" name="verified" value="0" /> 否
					<br />
					是否有头像：
					<input type="checkbox" name="hasPic" value="1" /> 是
					<input type="checkbox" name="hasPic" value="0" /> 否
					<br />
					是否收听我：
					<input type="checkbox" name="fllowMe" value="1" /> 是
					<input type="checkbox" name="fllowMe" value="0" /> 否
					<br />
				</div>
				<div id="fetchList"></div>
				<input id="fetchBtn" value="拉取" type="button" />
			</div>
		</div>
		<!-- /main -->
		
		<!-- sidebar -->
		<div id="SideBar">
			
		</div>
		<!-- /sidebar -->
	</div>
	<!-- /body -->
	
	<!-- footer -->
	<div id="Footer" class="clearfix"><{include file="sina/_footer.html"}></div>
	<!-- /footer -->
</div>
</body>
</html>

<!-- JS -->
<{JS}>
<script type="text/javascript">
$(function() {
	///
	var p = 1;
	$("#fetchBtn").click(function() {
		$.post("<{url r='sina/friends'}>", 
			{p:p}, 
			function(data) {
				console.log(data);
				///
				p++;
				if (data.end == 1) {
					alert("已经加载完毕。");
				} else {
					var list = data.list;
					var len = list.length;
					var divList = $("#fetchList");
					///
					for (i=0; i<len; i++) {
						var v = list[i];
						var dom = "";
						dom += '<div class="item"';
						dom += ' _fllowMe='+ v._fllowMe;
						dom += ' _gender='+ v._gender;
						dom += ' _hasPic='+ v._hasPic;
						dom += ' _verified='+ v._verified;
						dom += '>';
						dom += '<div class="img"><img src="'+ v.profile_image_url +'" /></div>';
						dom += '<div class="info">';
						dom += '<span>呢称：'+ v.screen_name +'</span> | ';
						dom += '<span>关注数：'+ v.friends_count +'</span> | ';
						dom += '<span>粉丝数：'+ v.followers_count +'</span> | ';
						dom += '<span>最后微博时间：'+ v._lastPostTime +'天前</span> | ';
						dom += '<span>微博数：'+ v.statuses_count +'</span>';
						dom += '</div>';
						dom += '</div>';
						
						///
						divList.append(dom);
					}
				}
			}, "json");
	});
	
	///
	function checkSelect() {
		var attrs = [];
		var keys = ["gender", "verified", "hasPic", "fllowMe"];
		for (j=0; j<keys.length; j++) {
			attrs[j] = [];
			var field = keys[j];
			var list = $("input[name='"+ field +"']:checked");
			var size = list.length;
			for (i=0; i<size; i++) {
				var tmp = "[_"+ field +"='"+ $(list[i]).val() +"']";
				attrs[j][i] = tmp;
			}
		}
		alert(attrs);
	}
	
	///
	$("input[name='gender']").click(function() {checkSelect();});
	$("input[name='verified']").click(function() {checkSelect();});
	$("input[name='hasPic']").click(function() {checkSelect();});
	$("input[name='fllowMe']").click(function() {checkSelect();});
});
</script>
